package com.sxhalo.fsms.service;

import com.sxhalo.fsms.mapper.FactDeviceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class FactDeviceService {

	@Autowired
	private FactDeviceMapper mapper;

	@Autowired
	private RedisTemplate<String, ?> redisTemplate;

	public List<Integer> getAllId(String where) {
		return mapper.getAllId(where);
	}

	public Map<Object, Object> getLiveData(String deviceId) {
		Map<Object, Object> map = null;
		try {
			map = redisTemplate.opsForHash().entries(deviceId);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

}
